<template>
	<view>
		<u-popup
		border-radius="20"
		v-model="show"
		mode="bottom"
		:mask="true"
		:zIndex="100"
		>
			<view class="remark-view flex-y-c">
				<view class="remark-title">拒绝原因</view>
				<view class="text-area">
					<textarea 
					class="area"
					 @confirm="confirm" 
					 placeholder="请输入拒绝原因" 
					 :maxlength="100"
					 @input="submitText"
					 :cursor-spacing="140"
					 v-model="custRemark"  name="" id="" cols="30" rows="10"></textarea>
					<view class="input-limit fc-99"><span :class="{'fc-ff': custRemark.length > 90}">{{custRemark.length}}</span>/100</view>
				</view>
				<view class="submit-btn" @click="confirm">
					<u-button type="error" @click="handleRefuse" text="审核拒绝"></u-button>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import uPopup from '@/common/uView/u-popup'
	export default {
		components: {
			uPopup
		},
		data() {
			return {
				show: false,
				custRemark: '',
				shopId: ''
			}
		},
		methods: {
			showPop() {
				this.show = true
				this.custRemark = ''
			},
			confirm() {
				if (!this.custRemark) return this.$utils.toast('请填入拒绝理由')
				this.$emit('remarkComfirn', {
					custRemark: this.custRemark, 
				})
				this.show = false
			},
			submitText(e) {
				if(e.detail.cursor>100){//ios 超过五百截取文字
					let mContent = e.detail.value.substring(0, 100);
					this.custRemark = mContent
					this.$forceUpdate();
				}
				this.$forceUpdate();
			},
		}
	}
</script>

<style scoped lang="scss">
	.remark-view{
		padding-bottom: calc(constant(safe-area-inset-bottom) + 14rpx);
		padding-bottom: calc(env(safe-area-inset-bottom) + 14rpx);
		.submit-btn{
			width: 710rpx;
			height: 80rpx;
			margin-top: 20rpx;
		}
	}
	.remark-title{
		font-size: 32rpx;
		height: 112rpx;
		text-align: center;
		line-height: 112rpx;
	}
	.text-area{
		width: 702rpx;
		height: 352rpx;
		padding: 18rpx 24rpx;
		box-sizing: border-box;
		background: #F6F6F6;
		position: relative;
		border-radius: 12rpx;
		text-indent: 10rpx;
		.area{
			width: 654rpx;
		}
		.input-limit{
			position: absolute;
			right: 24rpx;
			bottom: 24rpx;
		}
	}
</style>